#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=20050;
int c[MAXN];
bool cmp(int a,int b){
    return a>b;
}
int main(void){
    int n;
    int sum;
    while(~scanf("%d%d",&n,&sum)){
        for(int i=0;i<n;i++){
            scanf("%d",&c[i]);
        }
        sort(c,c+n,cmp);
        int ans=0;
        int i=0;
        while(sum>0){
            ans++;
            sum-=c[i++];
        }
        printf("%d\n",ans);
    }
    return 0;
}
